<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>图书管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }

		function deleteBkInfo(bkId) {
			if(confirm("确定要删除编目信息？")){
				deleteBookAjax(bkId);
			}
		}
		function deleteBookAjax(bkId) {
			$.ajax({
				type: "POST",
				url: "${ctx}/book/manage/delete",
				data: {bkId: bkId},
				dataType: "json",
				success: function (data) {
					if (data.code == "0001") {
						top.$.jBox.info(data.msg, '提示', {
							closed: function () {
								window.location.href = "${ctx}/book/manage/list";
							}
						});
						top.$('.jbox-body .jbox-icon').css('top', '55px');

					} else {
						alertx("删除书籍信息失败");
					}
				}
			});
		}

		function btnClear() {
			$("#searchForm").find("input[type='text']").each(function () {
				$(this).val("");
			});
			$("#s2id_books").children("a").find(".select2-chosen").html("全部");
			$("#books").val("");
		}
	</script>
</head>
<body>
<ul class="nav nav-tabs">
	<li class="active">
		<a href="${ctx}/book/manage/list">书目列表</a>
	</li>
	<li>
		<a href="${ctx}/book/manage/form">导入marc</a>
	</li>
	<li>
		<a href="${ctx}/book/manage/get">新增书目</a>
	</li>
</ul>
	<form:form id="searchForm" modelAttribute="bkBookinfo" action="${ctx}/book/manage/list" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<ul class="ul-form">
			<li>
				<label>ISBN：</label><form:input path="isbn" htmlEscape="false" maxlength="20" class="input-medium"/>&nbsp;
			</li>
			<li>
				<label>题名：</label><form:input path="bookname" htmlEscape="false" maxlength="30" class="input-medium"/>&nbsp;
			</li>
			<li>
				<label>分类号：</label><form:input path="classcode" htmlEscape="false" maxlength="20" class="input-medium"/>&nbsp;
			</li>
			<li>
				<label>著者：</label><form:input path="author" htmlEscape="false" maxlength="30" class="input-medium"/>&nbsp;
			</li>
			<li>
				<label>出版社：</label><form:input path="publisher" htmlEscape="false" maxlength="30" class="input-medium"/>&nbsp;&nbsp;
			</li>
			<li>
				<label>丛编：</label>
				<form:select path="books" items="${fns:getBooksList()}" itemLabel="booksName" itemValue="id"
                             style="width: 250px;" class="input-medium">
                    <form:option value="qqq" label=""/>
                </form:select>
			</li>
			<li style="margin-left: 20px;">
				<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>&nbsp;&nbsp;
				<a href="javascript:void(0)" onclick="btnClear()" class="btn">清空条件</a>
				<a href="${ctx}/book/manage/exportAll" class="btn">全部导出</a>
			</li>
		</ul>

	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
		<tr>
			<th>序号</th>
			<th>ISBN</th>
			<th>题名</th>
			<th>副题名</th>
			<th>著者</th>
            <th>分类号</th>
			<th>丛编题名</th>
			<th>卷册号</th>
			<th>出版社</th>
			<th>价格</th>
			<th>操作</th>
		</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="info" varStatus="status">
			<tr>
				<td>${status.count}</td>
				<td>${info.isbn}</td>
				<td>${info.bookname}</td>
				<td>${info.othername}</td>
				<td><a href="${ctx}/book/manage/?repage&author=${info.author}">${info.author}</a></td>
                <td>${info.classcode}</td>
				<td><a href="${ctx}/book/manage/?repage&books=${info.books}">${info.books}</a></td>
				<td>${info.booksNum}</td>
				<td><a href="${ctx}/book/manage/?repage&publisher=${info.publisher}">${info.publisher}</a></td>
				<td>${info.price}</td>
				<td>
					<a href="${ctx}/book/manage/get?bkId=${info.id}">修改</a>
					<shiro:hasPermission name="book:manage:delete">
						<a href="javascript:void(0);" onclick="deleteBkInfo('${info.id}')">删除</a>
					</shiro:hasPermission>
                    <a href="${ctx}/book/manage/show?bkId=${info.id}">查看详细</a>
				</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>